# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Mihai Bişog <mihai.bisog@gmail.com>

pkgname=fmt
pkgver=9.1.0
pkgrel=4
pkgdesc='Open-source formatting library for C++'
arch=(x86_64)
url=https://fmt.dev
license=(MIT)
depends=(gcc-libs)
makedepends=(
  cmake
  doxygen
  git
  ninja
  npm
  python-breathe
  python-docutils
  python-jinja
  python-six
  python-sphinx
  python-wheel
)
provides=(libfmt.so)
_tag=a33701196adfad74917046096bf5a2aa0ab0bb50
source=(
  git+https://github.com/fmtlib/fmt.git#tag=${_tag}
  fmt-no-pip-no-virtualenv.patch
)
b2sums=('SKIP'
        '4e19e7b2cd8fd049b7c692c0efbc4b2f1dd6062f44a600f4f47be81ed0ed14defb4285eb09b8d8fb8bb55441689c3a659e157e91d2cdd94e4d7b00c28b6534f2')

prepare() {
  cd fmt
  patch -Np1 -i ../fmt-no-pip-no-virtualenv.patch
  git cherry-pick -n 0b0f7cfbfcebd021c910078003d413354bd843e2 # hip workaround
}

pkgver() {
  cd fmt
  git describe --tags
}

build() {
  cmake -S fmt -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBUILD_SHARED_LIBS=ON
  cmake --build build
  cmake --build build --target doc
}

check() {
  cmake --build build --target test
}

package() {
  DESTDIR="${pkgdir}" cmake --build build --target install
  install -Dm 644 fmt/LICENSE.rst -t "${pkgdir}"/usr/share/licenses/fmt/
}

# vim: ts=2 sw=2 et:
